<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">

    <title>Title</title>

</head>
<body>
--------------------section 1: bind data---------------<br/>
<div id="app">
    {{ message }}
    <input type="button" onclick="changemessage()" value="change">
</div>
<br/>--------------------section 2 bind data to attribute---------------<br/>
<div id="app-2">
  <span v-bind:title="message">
    Hover your mouse over me for a few seconds
    to see my dynamically bound title!
  </span>
    <input type="button" onclick="changemessage2()" value="change">
</div>
<br/>--------------------section 3 conditionals and loops---------------<br/>
<div id="app-3">
    <p v-if="seen">Now you see me</p>
    <input type="button" onclick="changemessage3()" value="change">
</div>

<div id="app-4">(bind data to structure of dom, not only text and attributes)
    <ol>
        <li v-for="todo in todos">
            {{ todo.text }}
        </li>
    </ol>
    <input type="button" onclick="pushdatatoapp4()" value="push">
</div>
<br/>--------------------section 4 handling user input---------------<br/>
<div id="app-5">[v-on directive to attach event listeners ]
    <p>{{message}}</p>
    <button v-on:click="reverseMessage">Reverse Message</button>
</div>

<div id="app-6">
    <p>{{message}}</p>
    <input v-model="message">
</div>
</body>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script>

    //section 1
    var app = new Vue({
        el: '#app',
        data: {
            message: 'Hello Vue!'
        }
    });
    function changemessage()
    {

        app.message="hello,vue,this is new message";
    }
    //section 2
    var app2 = new Vue({
        el: '#app-2',
        data: {
            message: 'you load this page on :'+new Date()
        }
    });
    function changemessage2()
    {

        app2.message="some new message for section2";
    }
    // section 3
    var app3 = new Vue({
        el: '#app-3',
        data: {
            seen: true
        }
    });
    function changemessage3()
    {

        app3.seen=!app3.seen;
    }
    var app4 = new Vue({
        el: '#app-4',
        data: {
            todos: [
                { text: 'Learn JavaScript' },
                { text: 'Learn Vue' },
                { text: 'Build something awesome' }
            ]
        }
    });
    function pushdatatoapp4()
    {
        app4.todos.push({text:"pushed on "+new Date()})
    }
// section handling user input

    var app5 = new Vue({
        el: '#app-5',
        data:{
            message:"hello,vue.js"
        },
        methods:{
            reverseMessage:function(){
                this.message=this.message.split('').reverse().join('');
            }
        }
    });

    var app6=new Vue(
            {
                el:'#app-6',
                data:{
                    message:"hello vue!"
                }
            });
//section 
</script>
</html>